package com.titan.demo.camel.sample.eip.split.SplitAggregationStrategy;

import java.util.ArrayList;
import java.util.List;

import org.apache.camel.Exchange;

public class TttBean {
	private static List<Integer> build(int...values) {
		List<Integer> li = new ArrayList<Integer>();
		for (int i = 0; i < values.length; i++) {
			li.add(values[i]);
		}
		return li;
	}
	public void start(Exchange exchange){
	    List<List<Integer>> ii = new ArrayList<List<Integer>>();
        ii.add(build(10,11,12));
        ii.add(build(13,14));
        ii.add(build(17,18,19,20));
	    exchange.getIn().setBody(ii);
	    System.out.println("start....");
	}


	public  void  processOneLi(Exchange exchange){
	    System.out.println("CamelSplitIndex:"  + exchange.getProperty("CamelSplitIndex", int.class));
	    System.out.println("CamelSplitSize:"  + exchange.getProperty("CamelSplitSize", int.class));
	    System.out.println("CamelSplitComplete:"  + exchange.getProperty("CamelSplitComplete", boolean.class));
	    List<Integer> li = exchange.getIn().getBody(List.class);
	    System.out.println("oneLi >> " + li);
	}

	  

	public  void  processOne(Exchange exchange){
	    System.out.println("CamelSplitIndex:"  + exchange.getProperty("CamelSplitIndex",int.class));
	    System.out.println("CamelSplitSize:"  + exchange.getProperty("CamelSplitSize",int.class));
	    System.out.println("CamelSplitComplete:"  + exchange.getProperty("CamelSplitComplete",boolean.class));

	    int  i = exchange.getIn().getBody(int.class);
	    System.out.println("one >> " + i);
	}


	public  void  end(Exchange exchange){
	    System.out.println("ending....");
	}
}
